Added a method to cap the size of the cache in DijkstraShortestPaths and DijkstraDistance#80
Open
lhepto wants to merge 1 commit intojrtom:masterfrom
Open
Added a method to cap the size of the cache in DijkstraShortestPaths and DijkstraDistance#80lhepto wants to merge 1 commit intojrtom:masterfrom
lhepto wants to merge 1 commit intojrtom:masterfrom
Conversation
…nd DijkstraDistance, which allows it to run on large graph continuously without GC or memory issues
tomnelson
reviewed
Nov 21, 2017
| protected Hypergraph<V,E> g; | ||
| protected Function<? super E,? extends Number> nev; | ||
| protected Map<V,SourceData> sourceMap; // a map of source vertices to an instance of SourceData | ||
| protected LinkedHashMap<V,SourceData> sourceMap; // a map of source vertices to an instance of SourceData |
Contributor
There was a problem hiding this comment.
Sorry if I missed a discussion of this, but is the cost (of a possible virtual lookup when declaring as the most general type) really a factor with modern JVMs?
Contributor
There was a problem hiding this comment.
If it is a factor on modern JVMs, I've personally not heard of it. :/
IIRC, it's more idiomatic to keep the base type here as Map, i.e. whatever interface is most generic, or as high up the type hierarchy as possible, that has all the methods one needs.
Just my 2 cents.
Contributor
|
Was there ever a plan to merge this? |
Owner
|
It's on my list of things to look at before the 3.0 release. Haven't gotten to it yet. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a proof of concept to show the benefit of implementing a cap on the size of the cache.
It allows the user to perform a large number of shortest path calculations on large graph, continuously without GC or memory issues, when they are memory constrained in the VM.
See the new test cases TestCachingLargeGraph for an example.
Tested with VM options: -Xms128m-Xmx750m